
#ifndef _VHAND_LOADER_H
#define _VHAND_LOADER_H

//---------------------------------------------------------------------------
//  Includes
//---------------------------------------------------------------------------

#include <HandConfig.h>
#include <Hand.h>

namespace vhand
{

using defE::Point2f;

//***************************************************************************
//                               Loader
//***************************************************************************

/** 
 */

class Loader
{
public:
    Loader( const std::string &cfg );
    void loadHand( Hand *hand );

private:
    void loadBonesGeom( Geometry *bonesgeom, Armature* armature, const std::string &filename );
    void loadBonesArmature( Armature *arm, const std::string &filename );
    void loadSkinGeom( Geometry *skingeom, const std::string &skinobjfile );
    void loadSpheres( SphereFilledBody *spherebody, const std::string &spherefile );
    int  loadTopology( SphereTopology *topo, const std::string &filefullname );
    void writeTopology( const SphereTopology *topo, const std::string &filefullname );
    void loadSssArgument( SphereFilledBody *vh );

    void loadTexture( Geometry *geom, const std::string &filename );
    void loadMaterial( Geometry *geom, const std::string &filename );

    static void findNextPartString( std::string *line,
                                    std::string *part,
                                    const std::string &delim );
    static void findNextPartString( std::string *line,
                                    std::string *part,
                                    const char *delim );

    static void string2vec( Vector4 *vec4, std::string str );
    static void string2vec( Vector3 *vec3, std::string str );


    /** 
     */
    std::map<std::string, std::string> _config;

    /** 
     */
    std::string _fileloaddir;


}; // class Loader

} // namespace vhand

#endif // _VHAND_LOADER_H

